import Vue from 'vue'
import Vuex from 'vuex'
import Cookie from 'js-cookie'
import http from '../plugins/http'
// console.log(Cookie.get('token'))
// console.log('无法获取')
Vue.use(Vuex)
const store = () => new Vuex.Store({
  state: () => ({
    isLogin: false,
    keyWord: "",
    buyNum:0,//购物数量
  }),
  mutations: {
    changeLoginStatus(state, val) {
      state.isLogin = val
    },
    searchKeword(state, val) {
      state.keyWord = val
    },
    joinCar(state, val) {
      console.log('购物车数量-->',val)
      http("get",'/sys/iaShoppingTrolley/findPage.do',{pageNum:1,pageSize:10}).then(res=>{
        if (res.code=='0000') {
          state.buyNum = res.result.total
        }
      })
   

    }
  },
  modules: {


  }
})
export default store